<%-- 
    Document   : vieworders
    Created on : Jul 3, 2011, 10:10:45 PM
    Author     : PhongLK60473
--%>

<%@page import="Object.CustomerOrder"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <style type="" >
            @import url("style/style.css");
            @import url("style/vieworders.style.css");
        </style>
    </head>
    <body>
        <%@include file="header.jsp" %>
        <%
                    if (user.isGuest()) {
                        response.sendRedirect("UserController");
                    }

                    CustomerOrder[] orders = CustomerOrder.getAllOrders(user.getId());

        %>
        <div id="page">
        <h1>All of your Order</h1>

        <%
                    if (orders == null || orders.length == 0) {
                        %>
                        <h2>No order existed!</h2>
                        <%
                    } else {
        %>
        <table border="1" class="orders">
            <thead>
                <tr class="title">
                    <th class="No">No.</th>
                    <th class="Time">Time</th>
                    <th class="Price">Total Price</th>
                    <th class="Status">Status</th>
                </tr>
            </thead>
            <tbody>
                <%
                                        for (int i = 0; i < orders.length; i++) {

                %>
                <tr class="data">
                    <td class="No"><%= (i+1) %></td>
                    <td class="Time"><%= orders[i].getDate() %> | <%= orders[i].getTime() %></td>
                    <td class="Price"><%= orders[i].getTotalPrice() %></td>
                    <td class="Status"><%= orders[i].getStatus() %></td>
                </tr>
                <%

                                        }
                        %>
            </tbody>
        </table>
    </div>
        <%}%>
    </body>
</html>
